package com.app.bimo.library_db;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Transient;

import androidx.annotation.Nullable;

@Entity
public class ChapterData {
    @Id
    private String id;
    private String novelid;
    private String chapterid;
    private String chapterTitle;
    private String chapterName;
    private int chapterNumber;
    private String decTime;
    private double bookCoin;

    private int wordNum;
    private String content;
    private String path;

    /**
     * 是否可阅读
     * 0不可阅读
     * 1可阅读
     */
    private int canRead;
    /**
     * 是否可下载
     * 0不可下载
     * 1可下载
     */
    private int canDownload;
    /**
     * 用于缓存后 章节列表页展示  是否是阅读过
     * 0，未读过，1当前阅读  2 已读过
     */
    private int isRead = 0;
    /**
     * 是否已经下载（本地有数据即为已下载）
     */
    @Transient
    private boolean isDown = false;
    /**
     * int
     * <p>
     * 普通用户是否免费阅读
     * 0收费  1免费
     * vip用户  小说详情点开目录  有锁
     * vip用户  阅读页开目录  无锁
     */
    private int isFree = 0;

    /**
     * 是否需要登录
     * 0 无需登录
     * 1 登录后才能阅读
     */
    private int needLogin = 0;

    private boolean isCache = false;


    @Generated(hash = 653324942)
    public ChapterData(String id, String novelid, String chapterid, String chapterTitle, String chapterName,
            int chapterNumber, String decTime, double bookCoin, int wordNum, String content, String path, int canRead,
            int canDownload, int isRead, int isFree, int needLogin, boolean isCache) {
        this.id = id;
        this.novelid = novelid;
        this.chapterid = chapterid;
        this.chapterTitle = chapterTitle;
        this.chapterName = chapterName;
        this.chapterNumber = chapterNumber;
        this.decTime = decTime;
        this.bookCoin = bookCoin;
        this.wordNum = wordNum;
        this.content = content;
        this.path = path;
        this.canRead = canRead;
        this.canDownload = canDownload;
        this.isRead = isRead;
        this.isFree = isFree;
        this.needLogin = needLogin;
        this.isCache = isCache;
    }

    @Generated(hash = 1144643282)
    public ChapterData() {
    }


    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public String getChapterid() {
        return chapterid;
    }

    public void setChapterid(String chapterid) {
        this.chapterid = chapterid;
    }

    public String getChapterTitle() {
        return chapterTitle;
    }

    public void setChapterTitle(String chapterTitle) {
        this.chapterTitle = chapterTitle;
    }

    public String getChapterName() {
        return chapterName;
    }

    public void setChapterName(String chapterName) {
        this.chapterName = chapterName;
    }

    public int getChapterNumber() {
        return chapterNumber;
    }

    public void setChapterNumber(int chapterNumber) {
        this.chapterNumber = chapterNumber;
    }

    public String getDecTime() {
        return decTime;
    }

    public void setDecTime(String decTime) {
        this.decTime = decTime;
    }

    public double getBookCoin() {
        return bookCoin;
    }

    public int getBookCoinInt() {
        return (int) bookCoin;
    }

    public void setBookCoin(double bookCoin) {
        this.bookCoin = bookCoin;
    }

    public int getWordNum() {
        return wordNum;
    }

    public void setWordNum(int wordNum) {
        this.wordNum = wordNum;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }


    public int getIsRead() {
        return isRead;
    }

    public void setIsRead(int isRead) {
        this.isRead = isRead;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getNovelid() {
        return novelid;
    }

    public void setNovelid(String novelid) {
        this.novelid = novelid;
    }


    @Override
    public boolean equals(@Nullable Object obj) {
        if (obj instanceof ChapterData) {
            ChapterData chapterData = (ChapterData) obj;
            if (chapterData.getNovelid() == null || getNovelid() == null) {
                return super.equals(obj);
            }
            return chapterData.getNovelid().equals(getNovelid()) && chapterData.getChapterid().equals(getChapterid());
        }
        return false;
    }

    public int getCanRead() {
        return this.canRead;
    }

    public void setCanRead(int canRead) {
        this.canRead = canRead;
    }

    public int getCanDownload() {
        return this.canDownload;
    }

    public void setCanDownload(int canDownload) {
        this.canDownload = canDownload;
    }

    public int getIsFree() {
        return isFree;
    }

    public void setIsFree(int isFree) {
        this.isFree = isFree;
    }

    public boolean getIsDown() {
        return this.isDown;
    }

    public void setIsDown(boolean isDown) {
        this.isDown = isDown;
    }

    public int getNeedLogin() {
        return this.needLogin;
    }

    public void setNeedLogin(int needLogin) {
        this.needLogin = needLogin;
    }

    public boolean getIsCache() {
        return this.isCache;
    }

    public void setIsCache(boolean isCache) {
        this.isCache = isCache;
    }

}
